package api

import (
	"net/http"
	"user-center/src/service"

	"github.com/gin-gonic/gin"
	log "github.com/sirupsen/logrus"
)

func AiCodeUpgrader(ctx *gin.Context) {
	AiCodeserveWebSocket(ctx.Writer, ctx.Request)
}

func AiCodeserveWebSocket(w http.ResponseWriter, r *http.Request) {
	conn, err := upgrader.Upgrade(w, r, nil)
	if err != nil {
		log.Println("code websocket upgrader error: ", err)
		return
	}
	defer conn.Close()
	service.AiCodeDealWebsocketConn(conn)
}
